package moe.oil.api.databaseAPI;

import moe.oil.dto.ProfessionalDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "database-service",contextId = "ProfessionalAPI")
//@RequestMapping("/professional")
public interface ProfessionalAPI {
    // 根据id查询专业
    @GetMapping("/professional/{id}")
    public ProfessionalDTO findByIdProfessional(@PathVariable("id") Long id);

    // 根据专业名查询
    @GetMapping("/professional/query")
    public ProfessionalDTO findNameProfessional(@RequestBody ProfessionalDTO professionalDTO);

    // 查询全部专业
    @GetMapping("/professional/{page}/{size}")
    public List<ProfessionalDTO> findAllProfessional(@PathVariable("page") int page, @PathVariable("size") int size);

    // 添加
    @PostMapping("/professional")
    public ProfessionalDTO saveProfessional(@RequestBody ProfessionalDTO professionalDTO);

    // 根据ID删除专业
    @DeleteMapping("/professional/{id}")
    public int deleteByIdProfessional(@PathVariable("id") Long id);

    // 修改
    @PutMapping("/professional")
    public ProfessionalDTO updateProfessional(@Validated ProfessionalDTO professionalDTO);

}
